import 'package:flutter/material.dart';

class RichTextUtil {
  static RichText getRichText(String title, {String leftStar = '*'}) {
    List<TextSpan> spans = [];
    TextSpan left = TextSpan(
        text: title, style: TextStyle(fontSize: 14, color: Color(0xff333333)));
    TextSpan right =
        TextSpan(text: leftStar, style: TextStyle(color: Colors.red));
    spans.add(left);
    spans.add(right);
    return RichText(
      text: TextSpan(children: spans),
    );
  }

  static RichText getRichText2(String title, {String leftStar = '*'}) {
    List<TextSpan> spans = [];
    TextSpan left = TextSpan(
        text: title,
        style: TextStyle(
            fontSize: 18,
            color: Color(0xff333333),
            fontWeight: FontWeight.bold));
    TextSpan right = TextSpan(
        text: leftStar,
        style: TextStyle(
            color: Colors.blue, fontSize: 18, fontWeight: FontWeight.bold));
    spans.add(right);
    spans.add(left);
    return RichText(
      text: TextSpan(children: spans),
    );
  }

  static RichText getRichText3(String leftStr,int leftColor, String rightStr,int rightColor) {
    List<TextSpan> spans = [];
    TextSpan left = TextSpan(
        text: leftStr,
        style: TextStyle(
            fontSize: 22,
            color: Color(leftColor),
            fontWeight: FontWeight.normal));
    TextSpan right = TextSpan(
        text: rightStr,
        style: TextStyle(
            color: Color(rightColor), fontSize: 13, fontWeight: FontWeight.normal));
    spans.add(left);
    spans.add(right);
    return RichText(
      text: TextSpan(children: spans),
    );
  }
}
